<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	response.setHeader("Pragma", "No-cache");
	response.setHeader("Cache-Control", "no-cache");
	response.setDateHeader("Expires", 0);
%>
<!DOCTYPE html>
<html>
	<head lang="en">
	    <meta charset="UTF-8">
	    <title>职业列表</title>
		<jsp:include page="../common/top.jsp"></jsp:include>
  	</head>
	<body class="page-content">
		<div class="page-content-area" data-ajax-content="true">
			<div class="page-header">
				<h1>职业列表</h1>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="row">
						<div class="col-xs-12">
							 <div class="widget-box">
								<div class="widget-header widget-header-small">
									<h5 class="widget-title lighter">搜索栏</h5>
								</div>
								<div class="widget-body">
									<div class="widget-main">
										<form id="_form" class="form-inline">
											<label>
												<label class="control-label" for="form-field-1">职位名字： </label>
												<input name="jobName" type="text" class="form-data input-medium search-data">
											</label>
										</form>
									</div>
								</div>
			
							</div>
							<div>
								<div class="dataTables_wrapper form-inline no-footer">
									<table id="_table" class="table table-striped table-bordered table-hover dataTable no-footer"></table>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

			 <div id="formLoad" name="formLoad" style="display: none;width: 98%">
				<textarea rows="10" cols="50" id='msg-txt'></textarea>			
		</div>  
		
		<jsp:include page="../common/bottom.jsp"></jsp:include>
		<script type="text/javascript">
			var $table;
			jQuery(function($) {
				// 列表
	    		 $table = $("#_table").table({
	    			url : "job/list",
	    			formId : "_form",
					tools : [
						{text : '添加职位', clazz : 'btn-info', icon : 'fa fa-plus-circle blue', permission : '/admin/job/edit', handler : function(){
							window.location.href = "${path}/admin/job/edit";
						}},  
						{text : '删除', clazz : 'btn-danger', icon : 'fa fa-trash-o red', permission : '/admin/job/delete', handler : function(){
							$table.ajaxDelete({
								confirm : "该操作会删除选中的目录，请确定操作吗?", 
								url : "${path}/admin/job/delete"
							});
						}}
					],
					columns : [
				        {field:'id', hide : true},
				        {field:'companyName', title:'公司名字', align:'left'},
				        {field:'jobName', title:'职位名称', align:'left'},
				        {field:'expTime', title:'所需工作经验', align:'left',
				        	 replace:function(row){
					        		if(row.expTime ==1 ){
					        			return "应届生";
					        		}else if(row.expTime == 2){
					        			return "一年以内";
					        		}else if(row.expTime == 3){
					        			return "1-3年";
					        		}else if(row.expTime == 4){
					        			return "3-5年";
					        		}else if(row.expTime == 5){
					        			return "5-10年";
					        		}else{
					        			return "10年以上"
					        		}
					        		}},
				        {field:'education', title:'学历要求', align:'left',
				        	replace:function(row){
				        		if(row.education ==1 ){
				        			return "中专及以下";
				        		}else if(row.education == 2){
				        			return "高中";
				        		}else if(row.education == 3){
				        			return "大专";
				        		}else if(row.education == 4){
				        			return "本科";
				        		}else if(row.education == 5){
				        			return "硕士";
				        		}else{
				        			return "博士"
				        		}
				        		}},
				        {field:'salary', title:'薪水', align:'left'}
				        ],
					operate : [
						{text : '编辑', clazz : 'blue', icon : 'fa fa-pencil', permission : '/admin/job/edit', handler : function(d, i){
							window.location.href = "${path}/admin/job/edit?id=" + d.id;
						}},
						{text : '删除', clazz : 'red', icon : 'fa fa-trash-o', permission : '/admin/job/delete', handler : function(d, i){
							$table.ajaxDelete({
								confirm : "该操作会删除选中的目录，请确定操作吗?",
								url : "${path}/admin/job/delete"
							});
						}}
						
					],
					after : function(){
						// 权限处理
						$.permission();
					}
				});
				
				$("#type").change(function(){
					$table.search();
				});
			});
			
		</script>

	</body>
</html>

